package com.sondertara.joya;

import com.github.javaparser.JavaParser;
import com.github.javaparser.ast.CompilationUnit;
import com.github.javaparser.ast.Modifier;
import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration;
import com.github.javaparser.ast.body.FieldDeclaration;
import com.github.javaparser.ast.expr.Expression;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
import com.jn.sqlhelper.common.annotation.Table;
import lombok.Data;

/**
 * TODO
 *
 * @author ${USER}
 * @date ${DATE} ${TIME}
 */
@Data
public class Main {


    private static final JavaParser JAVA_PARSER = new JavaParser();

    public static void main(String[] args) {
        System.out.println("Hello world!");

        CompilationUnit compilationUnit = new CompilationUnit();
        compilationUnit.setPackageDeclaration("com.xxx.dao.po");
        compilationUnit.addImport("lombok.Data");

        ClassOrInterfaceDeclaration classOrInterfaceDeclaration = compilationUnit.addClass("TablePo").setPublic(true);
        classOrInterfaceDeclaration.addMarkerAnnotation("Data");
        classOrInterfaceDeclaration.addMarkerAnnotation("Entity");
        classOrInterfaceDeclaration.addAndGetAnnotation("Table").addPair("name", "\"t_pkg_product_res_decision\"");

//        classOrInterfaceDeclaration.addAnnotation("Table(name = \"t_pkg_product_res_decision\")");
        classOrInterfaceDeclaration.setBlockComment("这是一个注释");
        classOrInterfaceDeclaration.addField(Long.class, "id", Modifier.Keyword.PRIVATE).addAnnotation("Id").setBlockComment("主键");
        FieldDeclaration fieldDeclaration = classOrInterfaceDeclaration.addField(String.class, "name", Modifier.Keyword.PRIVATE);
        fieldDeclaration.addAndGetAnnotation("Column").addPair("name","\"name\"");
        fieldDeclaration.setBlockComment("名称");

        System.out.println(compilationUnit.toString());
    }
}